import {ref , onMounted} from "vue"
export default function useMousePoint(){
  const point = ref({
    x: -1,
    y: -1
  })
  //点击
  onMounted(()=>{
    document.onclick = (e: MouseEvent) =>{
      point.value.x = e.clientX
      point.value.y = e.clientY
    }
  })
  //重置
  const reset = () => {
    point.value = {
      x: -1,
      y: -1
    }
  }

  return{
    point,
    reset
  }
}